package com.goldgov.utils;

import org.gtiles.core.web.json.ClientMessage;
import org.gtiles.core.web.json.ClientMessage.severity_level;

import com.goldgov.kcloud.core.json.JsonObject;
import com.goldgov.kcloud.core.json.JsonSuccessObject;

public class JsonUtil {

	public static JsonSuccessObject<Object> success() {
		ClientMessage m=new ClientMessage();
		m.setMessage_severity(severity_level.success.toString());
		m.setMessage_text("执行成功");
		ClientMessage[] array= {m};
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "2000", "",array);  
		return ss;
		
	}
	public static JsonSuccessObject<Object> error() {
		ClientMessage m=new ClientMessage();
		m.setMessage_severity(severity_level.error.toString());
		m.setMessage_text("执行失败");
		ClientMessage[] array= {m};
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "5000", "",array);  
		return ss;
	}
	public static JsonSuccessObject<Object> error(String text) {
		ClientMessage m=new ClientMessage();
		m.setMessage_severity(severity_level.error.toString());
		m.setMessage_text(text);
		ClientMessage[] array= {m};
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "5000", "",array);  
		return ss;
	}
	public static JsonObject<Object> success(String text) {
		ClientMessage m=new ClientMessage();
		m.setMessage_severity(severity_level.success.toString());
		m.setMessage_text(text);
		ClientMessage[] array= {m};
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "2000", "",array);  
		return ss;
	}
	public static JsonSuccessObject<Object> errorMobile(String text) {
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "5000", text);
		return ss;
	}
	public static JsonObject<Object> successMobile(String text) {
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>("", "2000", text);
		return ss;
	}
	public static JsonObject<Object> success(Object obj,String text) {
		ClientMessage m=new ClientMessage();
		m.setMessage_severity(severity_level.success.toString());
		m.setMessage_text(text);
		ClientMessage[] array= {m};
		JsonSuccessObject<Object> ss=new JsonSuccessObject<Object>(obj, "2000", "",array);  
		return ss;
	}
}
